package com.wzg;

import javax.swing.*;
import java.awt.*;

public record FormField(String label, JComponent component) {
    public JPanel createPanel() {
        JPanel panel = new JPanel(new BorderLayout());
        JLabel jLabel = new JLabel(label);
        jLabel.setHorizontalAlignment(SwingConstants.LEADING);
        panel.add(jLabel, BorderLayout.WEST);
        panel.add(component, BorderLayout.CENTER);
        return panel;
    }
}

/*
record FormField1(JButton button, JComponent component) {
    public JPanel createPanel() {
        JPanel panel = new JPanel(new BorderLayout(10, 0));
        button.setHorizontalTextPosition(SwingConstants.RIGHT);
        panel.add(button, BorderLayout.WEST);
        panel.add(component, BorderLayout.CENTER);
        return panel;
    }
}*/
